from packaging.tags import sys_tags
import sys
import platform

# 生成系统标签的函数
def sys_tags():
    """生成Python支持的平台标签列表"""
    tags = []
    # 简单生成一些常见的平台标签
    py_version = platform.python_version_tuple()
    py_major, py_minor = py_version[0], py_version[1]
    
    # 生成一些常见的平台标签
    archs = ['amd64', 'x86_64', 'win_amd64']
    abis = ['cp' + py_major + py_minor]
    
    for abi in abis:
        for arch in archs:
            tags.append(f'{abi}-{arch}')
            tags.append(f'{abi}-win32')
    
    return tags

print('当前Python支持的平台标签:')
supported_tags = list(sys_tags())
for i, tag in enumerate(supported_tags[:10]):  # 只显示前10个标签
    print(f'{i+1}. {tag}')

print(f'\n总共支持 {len(supported_tags)} 个平台标签')
print('Python版本:', sys.version)
print('操作系统:', sys.platform)
print('处理器架构:', platform.architecture())
print('Python版本元组:', platform.python_version_tuple())

# 查看wheel文件的标签
import os
for file in os.listdir('.'):
    if file.endswith('.whl'):
        print(f'\n找到wheel文件: {file}')
        # 提取wheel文件的标签信息
        # wheel文件名格式: package-version+build-python_version-abi_platform.whl
        parts = file.split('-')
        if len(parts) >= 5:
            python_tag = parts[3]
            abi_tag = parts[4].split('.')[0].split('_')[0]
            platform_tag = parts[4].split('.')[0].split('_')[1]
            print(f'Wheel文件标签: python={python_tag}, abi={abi_tag}, platform={platform_tag}')
            print('当前Python版本: cp{0}{1}'.format(*platform.python_version_tuple()[:2]))

# 尝试直接安装wheel文件，使用详细参数
print('\n尝试直接安装wheel文件(详细输出):')
print('命令示例: python -m pip install --no-deps --ignore-requires-python --force-reinstall --verbose vllm-0.10.1.1+cu124-cp312-cp312-win_amd64.whl')